package com.daoeping.action;

import java.util.ArrayList;
import java.util.List;
import com.daoeping.data.Bsc_language;
import com.daoeping.domain.JsonData;
import com.daoeping.service.Bsc_languageService;
import com.daoeping.util.ConverntJsonData;
import com.opensymphony.xwork2.ActionSupport;

public class Bsc_languageAction extends ActionSupport{
	
	private static final long serialVersionUID = 2466370827907485824L;
	private Bsc_languageService bsc_languageService;
	private JsonData jsonData;
	private List<Bsc_language> bsc_languageList;
	
	public Bsc_languageService getBsc_languageService() {
		return bsc_languageService;
	}

	public void setBsc_languageService(Bsc_languageService bsc_languageService) {
		this.bsc_languageService = bsc_languageService;
	}

	public List<Bsc_language> getBsc_languageList() {
		return bsc_languageList;
	}

	public void setBsc_languageList(List<Bsc_language> bsc_languageList) {
		this.bsc_languageList = bsc_languageList;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}

	public String findAllLanguage(){
		jsonData = new JsonData();
		bsc_languageList = bsc_languageService.findBsc_languageList();	
		List <String[]> strList = new ArrayList<String[]>();
		for (Bsc_language bsc_language : bsc_languageList) {
			String [] strarr = new String[2];
			strarr[1] = bsc_language.getId()+"";
			strarr[0] = bsc_language.getName();
			strList.add(strarr);
		}
		jsonData.setJsonData( new ConverntJsonData().getJsonData(strList)+"");
		return "alllanguage";
		
	}
	
}
